package scoketdemo;

import org.junit.Test;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class SocketDemo {

    @Test
    public void testOne(){
        try {
            InetAddress inetAddress = InetAddress.getLocalHost();
            System.out.println(inetAddress);
            System.out.println(inetAddress.getAddress());
            System.out.println(inetAddress.getHostAddress());
            System.out.println(inetAddress.getHostName());
            System.out.println(inetAddress.getCanonicalHostName());

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testTwo(){
        try {
            InetAddress inet6Address = Inet6Address.getLocalHost();

            System.out.println(inet6Address.getHostAddress());

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        System.out.println();
    }


}
